# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Crass00 <crass00 @ hotmail . com>

pkgname=python2-backports.functools_lru_cache
pkgver=1.6.4
pkgrel=1
pkgdesc="Backport of functools.lru_cache from Python 3.3"
arch=('any')
url="https://github.com/jaraco/backports.functools_lru_cache"
license=('MIT')
depends=('python2-backports')
makedepends=('python2-setuptools-scm')
checkdepends=('python2-pytest')
source=("https://pypi.io/packages/source/b/backports.functools_lru_cache/backports.functools_lru_cache-$pkgver.tar.gz")
sha512sums=('dab746440aeff8a411438f26f5c9a863929c41139c83bcfae51dcf29650c8e9d394b53a5f03b4e31ab7abd6a57249d719f155672e5585efb5f1851c8fe0a3de5')

prepare() {
  cd backports.functools_lru_cache-$pkgver
  # Style or coverage checks are not relevant for us
  sed -i 's/--flake8 --black --cov//' pytest.ini
}

build() {
  cd backports.functools_lru_cache-$pkgver
  python2 setup.py build
}

check() {
  cd backports.functools_lru_cache-$pkgver
  python2 -m pytest
}

package() {
  cd backports.functools_lru_cache-$pkgver
  python2 setup.py install --root="$pkgdir" --optimize=1

  rm "$pkgdir"/usr/lib/python2.7/site-packages/backports/__init__.py*
}
